/*
class Shape{
    public void draw(){
        System.out.println("画图形！");
    }
}
class Rect extends Shape{
    @Override
    public void draw() {
        System.out.println("矩形");
    }
    */
/*快捷键 输入draw
    右键 generate  override methods 重写方法
    *//*

}
class Cycle extends Shape{
    @Override
    public void draw() {
        System.out.println("圆");
    }
}

class Flower extends Shape{
    @Override
    public void draw() {
        System.out.println("❀");
    }
}

public class First{
    public static void drawMap(Shape shape){
        shape.draw();//一个引用调用一个方法，结果不同，原因：引用的对象不一样
        */
/*这里确实发生了动态绑定，动态绑定是多态的基础
        * 当我们引用的对象不一样，调用同一个重写的方法，表现的行为不一样
        * 这种思想 叫做多态
        * *//*

    }

    public static void drawMaps(){
        Cycle cycle = new Cycle();
        Rect rect = new Rect();
        Flower flower = new Flower();

        Shape[] shapes = {cycle,rect,cycle,rect,flower};//发生了向上转型
        for(Shape shape: shapes){
            shape.draw();
        }

    }
    public static void main(String[] args) {
        drawMaps();
        */
/*Cycle cycle = new Cycle();
        Rect rect = new Rect();
        Flower flower = new Flower();

        drawMap(cycle);
        drawMap(rect);
        drawMap(flower);*//*

    }
}

*/
